(function( $ ){
$.fn.appMenu = function() {
	// color definition
	var col1 = "#323232";
	var col2 = "#FADFAD";
	var col3 = "#AA9F9D";
	var col4 = "#f9f9ff";
	
	//this.css("font-family","lucida grande,tahoma,verdana,arial,sans-serif");
	//this.css("font-size","14px");
	this.css("line-height","18px");
	this.find('a').css("color",col1);
	this.find('a').css("text-decoration","none");
		
	// menu bar
	this.css("height","26px");	
	this.css("background",col2);
	//this.css("background","url() center left repeat-x");
	this.css("border","3px solid "+col2);
	this.css("border-bottom","1px solid "+col3);
	
	this.find("li").css("padding","1px 10px 1px 10px");
	this.find("li").css("margin","0px 0px 0px 0px");
	this.children("li");
	
	this.find("ul").find("a").css("display","inline-block");
	this.find("ul").find("a").css("padding","1px 5px 1px 5px");
	this.find("ul").find("a").css("border","1px solid "+col4);
	this.find("ul").find("a").css("width","200px");
	this.find("ul").css("padding","2px");
	this.find("ul").children("li").css("padding","0px");
	
	this.find("ul").find("a").hover(function(){
		$(this).css("background",col2);
		$(this).css("border","1px solid "+col3);
	}, function(){
		$(this).css("background","none");
		$(this).css("border","1px solid "+col4);
	});
	

	// menu bar button
	//this.children("li").css("padding","0px 0px 0px 0px");
	this.children("li").css("padding","0px");
	//this.children("li").css("border","1px solid "+col2);
	this.children("li").children("a").css("padding","2px 10px 2px 10px");
	this.children("li").children("a").css("display","block");
	this.children("li").children("a").css("position","relative");
	this.children("li").mouseover(function(){
		$(this).children("a").css("padding","1px 9px 1px 9px");
		$(this).css("border","1px solid "+col1);		
		$(this).children("a").css("z-index","9999");		
		$(this).children("a").css("background",col4);
		if ($(this).children("ul").html()) {
			$(this).children("a").css("padding-bottom","6px");			
		} else {
			$(this).children("a").css("padding-bottom","2px");			
		}
		$(this).children("ul").show();				
		$(this).children("ul").css("z-index","9998");				
	});
	this.children("li").mouseleave(function(){
		//$(this).css("border","1px solid "+col2);
		$(this).children("a").css("padding","2px 10px 2px 10px");
		$(this).css("border","none");
		$(this).children("a").css("z-index","1");		
		$(this).children("a").css("background","none");
		$(this).children("a").css("padding-bottom","2px");		
		$(this).children("ul").hide();		
		$(this).children('a').css("color",col1);						
	});
	
	// popup tile
	this.find("ul").css("padding","2px 2px 2px 2px");
	this.find("ul").css("margin","0px 0px 0px 0px");
	this.find("ul").css("min-width","200px");
	this.find("ul").css("border","1px solid "+col1);
	this.find("ul").css("position","absolute");
	this.find("ul").css("background",col4);
	this.find("ul").css("top","24px");
	this.find("ul").css("left","-1px");
	
	this.find("ul").css("list-style-type","none");
	
	this.css("margin","0px 0px 0px 0px");
	this.css("padding","0px 0px 0px 0px");
	this.css("list-style-type","none");
	this.children("li").css("position","relative");	
	//this.children("li").css("background",col2);
	this.children("li").css("display","inline");
	this.children("li").css("float","left");
	this.children("li").children("ul").hide();
	/*
	this.find("li").mouseover(function(){
		$(this).css("background","#627AAD");
		$(this).children("ul").show();
		$(this).children('a').css("color","#ffffff");
		
	});
	this.find("li").mouseleave(function(){
		$(this).children("ul").hide();		
		$(this).css("background","none");
		$(this).children('a').css("color",col1);		
		$(this).css("border","1px solid #d2d2d2");		
	});
	*/
};
})( jQuery );
